import request from '@/utils/request'

// 查询列表
export function listApplication(query) {
  return request({
    url: '/application/list',
    method: 'get',
    params: query
  })
}
// 获取左侧公司树列表
export function applicationDept(query) {
  return request({
    url: '/application/treeselect/dept',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    method: 'GET',
    params: query
  })
}
// 查询详细
export function getApplication(applicationId) {
  return request({
    url: '/application/' + applicationId,
    method: 'get'
  })
}


// 新增
export function addApplication(data) {
  return request({
    url: '/application/add',
    method: 'post',
    data: data
  })
}
// 修改
export function updateApplication(data) {
  return request({
    url: '/application/edit',
    method: 'post',
    data: data
  })
}
// 删除
export function delApplication(applicationIds) {
  return request({
    url: '/application/remove/' + applicationIds,
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    method: 'POST'
  })
}
// 审核
export function auditApplication(data) {
  return request({
    url: '/application/audit',
    method: 'post',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    params: data
  })
}
// 导出示例库
export function exportApplication(data) {
  return request({
    url: '/application/export',
    method: 'post',
    params: data,
    responseType: 'blob',
  })
}
// 通过标识id导出
export function exportByIds(query) {
  return request({
    url: '/application/exportByIds',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    method: 'POST',
    responseType: 'blob',
    params: query
  })
}

// 通过标识id下载审批单
export function downLoadApproval(applicationId) {
  return request({
    url: '/application/downLoadApproval',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    method: 'POST', responseType: 'blob',
    params: applicationId
  })
}
